#include <iostream>
#include "../../common/httplib.h"
// 服务器搭建流程
int main(){
    // 1. 实例化服务器对象 Server
    httplib::Server server;
    // 2. 注册回调函数 -- 告诉服务器收到哪个请求, 用对应回调函数来处理
    server.Get("/hi", [](const httplib::Request& req, httplib::Response &rsp){
        std::cout << "method: " << req.method << ", path: " << req.path << "\n";
        for(auto it: req.headers){
            std::cout << it.first << ": " << it.second << "\n";
        }
        std::string body = "<html><body><h1>Hello IsLand</h1></body></html>";
        rsp.set_content(body, "text/html");
        rsp.status = 200;
    });
    // server.Post();
    // 3. 启动服务器
    server.listen("0.0.0.0", 9090);
    return 0;
}